import {HtmlParser} from "./HtmlParser/HtmlParser";
import {ASTParser} from "./ASTParser/ASTParser";
import {generate} from "./CodeGenerator/Codegen";

const htmlParser = new HtmlParser();

/**
 *
 * @param {String} template
 * @param {Reactive} componentInstance
 * @return {{staticRenderFns: [], renderFn: string}}
 */
export function complie (template, componentInstance) {
    let hNodeRoot = htmlParser.parse(template);
    let astNodeRoot = ASTParser.parse(hNodeRoot, componentInstance.isComponent);
    return generate(astNodeRoot, { instance: componentInstance });
}
